home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / CHASSIS_ / MAINGETP.C < prev    next >
Text File  |  1992-05-14  |  2KB  |  51 lines

  1. /************************************************************************************/
  2. /*    MainGetProc                                                                        */
  3. /************************************************************************************/
  4.  
  5. #include "MyHeaders.h"
  6.  
  7. int MainGetProc ()
  8. {
  9.     int        MGRetCode = 0;
  10.  
  11.     Rect        mainRect;
  12.     int            rectHeight, rectWidth;
  13.     int            newH, newV;
  14.     int            itemHit;                                /* return from modal dialog    */
  15.     
  16.     windSub = 0;                                        /* point to main info        */
  17.  
  18.     if (useColor)
  19.         windTbl[windSub].windPtr =                        /* get the color template    */
  20.                 GetNewCWindow (128, &windTbl[windSub].windRec, (WindowPtr) -1);
  21.     else
  22.         windTbl[windSub].windPtr =                        /* get the template            */
  23.                 GetNewWindow (128, &windTbl[windSub].windRec, (WindowPtr) -1);
  24.  
  25.     windTbl[windSub].windRec.refCon = ProcMain;            /* save window type            */
  26.  
  27.     mainRect = (*windTbl[windSub].windPtr).portRect;    /* position wdow on desktop    */
  28.     rectHeight = mainRect.bottom - mainRect.top;        
  29.     rectWidth = mainRect.right - mainRect.left;
  30.     newH = (screenBits.bounds.right - rectWidth) * .50;    /* centered    horizonally        */
  31.     if (newH < 10)                                        /* (not less than 10)        */
  32.         newH = 10;
  33.     newV = ((screenBits.bounds.bottom                    /* vertical position        */
  34.              - rectHeight - 20) * .50) + 20;            /*   one-half down            */
  35.     if (newV < 40)                                        /* (not less than 40)        */
  36.         newV = 40;
  37.     MoveWindow (windTbl[windSub].windPtr, newH, newV, TRUE);    /* move into posit.    */
  38.     
  39.     SetPort (windTbl[windSub].windPtr);                    /* set as the grafPort        */
  40.  
  41.     TextFont(geneva);                                    /* choose the font...        */
  42.     TextFace(NIL);                                        /* ... style, and..            */
  43.     TextSize(10);                                        /* ... size                    */
  44.     
  45.     ShowWindow (windTbl[windSub].windPtr);
  46.  
  47.     InvalRect (&(*windTbl[windSub].windPtr).portRect);    /* indicate need for update    */
  48.  
  49.     return MGRetCode;
  50. }
  51.